﻿
@using Kendo.Mvc.UI;
@using System.Web.Mvc;
@using TS2015.Models;
@{
    ViewBag.Title = "SearchMark";
    AjaxOptions aj = new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "result",
        LoadingElementId = "loading-icon",
        OnFailure = "AjaxFailure",
        OnBegin = "AjaxBegin",
        OnComplete = "AjaxComplete"

    };
    
}
@{TS2015Context db = new TS2015Context();}
@model TS2015.Models.TbThiSinh
@using (Ajax.BeginForm(aj))
{
    @Html.AntiForgeryToken()
    <header class="panel-heading">
        <h3 style="text-align: center; font-weight: bold">Tìm kiếm điểm Thí sinh</h3>
    </header>
    <div class="panel-body">
        <div class="form-horizontal">
            <div class="form-group">
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Mã TS:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.MaTS, new { @class = "form-control" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Họ đệm:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.HoDem, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-4 col-md-4 row">
                    <strong class="col-lg-5 col-md-5 row">Tên:</strong>
                    <div class="col-lg-8 col-md-8 row">
                        @Html.TextBoxFor(m => m.Ten, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-3 col-md-3 row">
                    <strong class="col-lg-7 col-md-7 row">Điểm lớp 10:</strong>
                    <div class="col-lg-4 col-md-4 row">
                        @Html.TextBoxFor(m => m.DiemLop10, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-3 col-md-3 row">
                    <strong class="col-lg-7 col-md-7 row">Điểm lớp 11:</strong>
                    <div class="col-lg-4 col-md-4 row">
                        @Html.TextBoxFor(m => m.DiemLop11, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-3 col-md-3 row">
                    <strong class="col-lg-7 col-md-7 row">Điểm lớp 12:</strong>
                    <div class="col-lg-4 col-md-4 row">
                        @Html.TextBoxFor(m => m.DiemLop12, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
                <div class="col-lg-3 col-md-3 row">
                    <strong class="col-lg-7 col-md-7 row">Điểm TBTHPT:</strong>
                    <div class="col-lg-4 col-md-4 row">
                        @Html.TextBoxFor(m => m.DiemLop10, new { @class = "form-control", data_val = "false" })
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-12 col-md-12 row">
                    <strong>Tốt nghiệp THPT:</strong>
                </div>
                @{var ListSubject = from a in db.TbThiSinhs
                                  join b in db.TbDiemTotNghieps on a.MaTS equals b.MaTS
                                  join c in db.TbMonTotNghieps on b.MaMon equals c.MaMon
                                  where a.MaTS == Model.MaTS
                                  select b;}
                @foreach (var a in ListSubject)
                {
                    string ten = db.TbMonTotNghieps.First(m => m.MaMon == a.MaMon).TenMon;
                    //if (ten.ToLower() == "toán" || ten.ToLower() == "tiếng anh" || ten.ToLower() == "ngữ văn")
                    //{
                    //    continue;
                    //}
                    <div class="col-lg-3 col-md-3 row">
                        <div class="col-lg-7 col-md-7 row">
                            <div><strong>@ten:</strong></div>
                        </div>
                        <div class="col-lg-4 col-md-4 row">
                            @Html.TextBox("Mark1", a.Diem, new { @class = "form-control", type = "number" })
                            <input type="text" name="Subject1" class="hide" value="@a.MaMon" />
                        </div>
                    </div>
                }
            </div>
            <div class="clear"></div>
            <div class="form-group">
                <div class="col-md-offset-1 col-md-10" style="text-align:center; display:block">
                    <input type="submit" value="Tìm kiếm" class="btn btn-danger" id="SearchList" />
                    <div class="btn btn-danger" id="EmptyAll">Xóa trắng</div>
                </div>
            </div>
        </div>
    </div>
}
@*<div id="grid"></div>*@
<div id="result"></div>

<script>
    $('#EmptyAll').click(function () {
        $('#MaTS').val('');
        $('#HoDem').val('');
        $('#Ten').val('');
        $('#ProvinceIDS1').val('');
        $('#CommuneIDS1').empty();
        $('#DiaChi').val('');
        $('#CMND').val('');
        $('#ProvinceIDS').val('');
        $('#HighSchoolIDS').empty();
        $('#SBD').val('');
        $('#SoDienThoai').val('');
        $('#TrainingSystemID3').val('');
        $('#GroupID3').val('');
        $('#PhylumID3').empty();
        $('#MajorID3').empty();
    });
    
</script>
